package com.leyou.item.api;

import com.leyou.item.pojo.SpecGroup;
import com.leyou.item.pojo.SpecParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * 查询规格参数接口
 */
@RequestMapping("spec")
public interface SpecificationApi {
    @GetMapping("params")
    List<SpecParam> queryParamsByCid(
            // 都不是必填required = false
            @RequestParam(value = "gid", required = false) Long gid,  // 根据属性组里的gid去查属性
            @RequestParam(value = "cid", required = false) Long cid,  // 根据商品标准params里根据cid去查属性
            @RequestParam(value = "generic", required = false) Boolean generic, // 是否上下架
            @RequestParam(value = "searching", required = false) Boolean searching);


    /*
        根据cid获取大类以及大类下的参数（specGroup下有List<SpecParam>）
     */
    @GetMapping("{cid}")
    List<SpecGroup> querySpecsByCid(@PathVariable Long cid);

}

